<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>Paho MQTT C Client Library: MQTT Client library for C (MQTTClient)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="pahologo.png"/></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">Paho MQTT C Client Library
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="PageDoc"><div class="header">
  <div class="headertitle">
<div class="title">MQTT Client library for C (MQTTClient) </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><p>An MQTT client library in C.&copy; Copyright 2009, 2023 IBM Corp., Ian Craggs and others</p>
<p>These pages describe the original more synchronous API which might be considered easier to use. Some of the calls will block. For the new totally asynchronous API where no calls block, which is especially suitable for use in windowed environments, see the <a href="../../MQTTAsync/html/index.html">MQTT C Client Asynchronous API Documentation</a>. The MQTTClient API is not thread safe, whereas the MQTTAsync API is.</p>
<p>An MQTT client application connects to MQTT-capable servers. A typical client is responsible for collecting information from a telemetry device and publishing the information to the server. It can also subscribe to topics, receive messages, and use this information to control the telemetry device.</p>
<p>MQTT clients implement the published MQTT v3 protocol. You can write your own API to the MQTT protocol using the programming language and platform of your choice. This can be time-consuming and error-prone.</p>
<p>To simplify writing MQTT client applications, this library encapsulates the MQTT v3 protocol for you. Using this library enables a fully functional MQTT client application to be written in a few lines of code. The information presented here documents the API provided by the MQTT Client library for C.</p>
<p><b>Using the client</b><br  />
 Applications that use the client library typically use a similar structure: </p><ul>
<li>
Create a client object </li>
<li>
Set the options to connect to an MQTT server </li>
<li>
Set up callback functions if multi-threaded (asynchronous mode) operation is being used (see <a class="el" href="async.html">Asynchronous vs synchronous client applications</a>). </li>
<li>
Subscribe to any topics the client needs to receive </li>
<li>
Repeat until finished: <ul>
<li>
Publish any messages the client needs to </li>
<li>
Handle any incoming messages </li>
</ul>
</li>
<li>
Disconnect the client </li>
<li>
Free any memory being used by the client </li>
</ul>
<p>Some simple examples are shown here: </p><ul>
<li>
<a class="el" href="pubsync.html">Synchronous publication example</a> </li>
<li>
<a class="el" href="pubasync.html">Asynchronous publication example</a> </li>
<li>
<a class="el" href="subasync.html">Asynchronous subscription example</a> </li>
</ul>
<p>Additional information about important concepts is provided here: </p><ul>
<li>
<a class="el" href="async.html">Asynchronous vs synchronous client applications</a> </li>
<li>
<a class="el" href="callbacks.html">Callbacks</a> </li>
<li>
<a class="el" href="wildcard.html">Subscription wildcards</a> </li>
<li>
<a class="el" href="qos.html">Quality of service</a> </li>
<li>
<a class="el" href="tracing.html">Tracing</a> </li>
</ul>
</div></div><!-- PageDoc -->
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
Generated on Fri Oct 13 2023 18:02:52 for Paho MQTT C Client Library by&#160;<a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1
</small></address>
</body>
</html>
